<template>
	<view class="p12 pt30">
		<view class="u-flex u-f-justify" v-if="pointArticle.title">
			
				<image src="../../../static/image/ic-bi.png" class="w16 h16 mr10"></image>
			{{pointArticle.title}}
			<image src="../../../static/image/ic-bi.png" class="w16 h16 ml10"></image>
		</view>
		
		
		<view class="mt20 module-rule brs5 p16" style="background: rgba(25,41,28,0.05);">
			<view class="fz15">活动规则</view>
			<view class="fz12 c8 lh24 mt10" v-html="pointArticle.content">
				分享链接，好友成功注册账号即可获取相应的积分奖励；</br> 好友在小程序进行消费，根据消费金额可获取相应比例的积分奖励。 </br>积分奖励系统自动发放，无需手动领取，可在积分明细查看积分发放记录。
			</view>
		</view>
		<view class="mt18">
			<button class="inviteBtn fz14 u-font-bold" 	open-type="share">
				
				立即邀请
			</button>
		</view>
		<view class="u-flex mt32">
			
			<view class="u-f1 u-font-bold fz14" style="text-align: center;">
				<view class="fz24 mb4">{{inviteInfo.newUserCount}}</view>
				<view>已邀请好友</view>
			</view>
			<view class="u-f1 u-font-bold fz14" style="text-align: center;">
				<view class="fz24 mb4">{{inviteInfo.newUserPoint}}</view>
				<view>已奖励积分</view>
			</view>
		</view>
		<view class="u-flex mt32 u-f-jsb fz12 c6 bm pb12">
			用户<span>奖励积分</span>
		</view>
		<view>
			<view class="u-flex pt16 u-f-jsb bm pb16" v-for="(item,index) in inviteInfo.list" :key="index">
				<view class="u-flex fz14" v-if="item.user">
					<u-avatar class="mr10" size="80" :src="item.user.avatar"></u-avatar>
					{{item.user.nickname}}
				</view>
				<view class="fz14 u-font-bold" style="color: #70B52C;">{{item.point}}</view>
			</view>
		</view>
		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				curIndex: 0,
				userInfo:{},
				pointArticle:{},
				inviteInfo:{},
			};
		},
		computed: {},
		onShow() {
			this.initData()

		},
		
		onShareAppMessage(e) {
			console.log(e, 1111111)
		
			return {
			      title: '邀请好友',
				  path:'/pages/index/index?parentId='+this.userInfo.id,
			      imageUrl: '' // 图片 URL
			    }
		},
		
		methods: {
			initData() {
				
				
				this.$api.articleInfo({
					id:25
				}, res => {
					if (res.code == 200) {
						this.pointArticle = res.data
					}
				})
					this.$api.memberInfo({}, res => {
						if (res.code == 200) {
							this.userInfo = res.data;
						}
					})
				this.$api.new_user_static({}, res => {
					if (res.code == 200) {
						this.inviteInfo=res.data
					}
				})
				
				

			},
			toPage(url) {
				uni.navigateTo({
					url
				})
			}
		}
	};
</script>

<style lang="scss" scoped>
	page{
		background: #fff;
	}
	.item {
		width:50%;
		min-width: 50%;
		max-width: 50%;
		padding: 0 10rpx;
		margin-bottom: 30rpx;

		.item-content {
			padding:50rpx 20rpx;
			background: #F6F6F6;
			border: 1px solid #ccc;
			border-radius: 15rpx;
			text-align: center;
		}

		&.on {
			.item-content {
				background: #EDF6FF;
				border: 1px solid #51A5FC;
				color: #51A5FC;
			}
		}

	}

	.inviteBtn {
		background: #70B52C;
		color: #fff;
		height:88rpx;
		line-height: 88rpx;
		border-radius: 10rpx;
	}
</style>